/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package estg.dae.projecto.bank.controllers;

import estg.dae.projecto.bank.impl.ElectronicOperationTO;
import estg.dae.projecto.bank.model.Account;
import estg.dae.projecto.bank.model.AccountMovement;
import estg.dae.projecto.bank.model.Client;
import estg.dae.projecto.bank.model.ElectronicTransfer;
import estg.dae.projecto.exceptions.OfflinetransferFailedException;
import java.util.Collection;
import javax.ejb.Local;

/**
 *
 * @author Marco
 */
@Local
public interface AccountControllerLocal {
    boolean existsNib(String nib);
    boolean existsNumber(long number);
    Account get(long accountId);
    Account getByNib(String nib);
    Account getByNumber(long number);
    void save(Account account);
    void update(Account account);
    void delete(Account account);
    Collection<Account> getAll();
    Collection<AccountMovement> getMovements(long accountId, int movs);
    Account createAccount(Client client, int agencyCode, Double overBalance);

    public AccountMovement doWithdraw(String originAccountRef, double value) throws Exception;
    public AccountMovement doTransfer(String originAccountRef, String destinAccountRef, double value) throws Exception;
    public AccountMovement doMoneyDeposit(String destinAccountRef, double value) throws Exception;
    public AccountMovement doCheckDeposit(String originAccountRef, String destinAccountRef, double value) throws Exception;

    public Collection<ElectronicTransfer> getofflineTransfers();

    public void executeOnlineOperation(ElectronicOperationTO operation) throws OfflinetransferFailedException;
    public void confirmOnlineOperation(ElectronicOperationTO operation) throws OfflinetransferFailedException;
    public void failedOnlineOperation(ElectronicOperationTO operation, String message);
}
